Plotten der Daten

  • df.plot hat noch Probleme mit Subplots und Figures

In [4]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

plt.style.use('ggplot')


dfs = [pd.read_csv('http://5.189.161.24:8080/DATA/politics_top25words_{}.csv'.format(Y), 
                   index_col=0) 
       for Y in range(2001, 2017)]

fig, axes = plt.subplots(4, 4, figsize=(20,20))
fig.subplots_adjust(hspace = 0.4)

for i in range(4):
    for j in range(4):
        
        indx = i*4 + j
        
        df = dfs[indx] 
        ax = axes[i, j]

        df.plot(ax = ax, kind='bar')
        ax.legend_.remove()
        ax.set_title(2001+indx) 
        ax.set_xlabel('')

        for tick in ax.get_xticklabels():
            tick.set_fontsize(8)
            tick.set_color('black')
            tick.set_rotation(70)
plt.show()